﻿using System;
using System.Collections.Generic;
using System.Windows;
using Tisbi.LawFirm.DAL.Models;

namespace Tisbi.LawFirm.BL.Services.Implementation.Mock
{
    public class MockCustomersServiceAgent : MockServiceAgentBase<Customers>
    {
        private List<Customers> mockCustomers;

        public MockCustomersServiceAgent()
        {
            mockCustomers = new List<Customers>
            {
                new Customers
                {
                    Id = 1,
                    CustomerType = CustomerType.ФизическоеЛицо,
                    Title = "Дмитрий Иванович",
                    FullFio = "Седов Дмитрий Иванович",
                    Phone = "+79503222666",
                    Email = "sedov@gmail.com",
                    Address = "420138, Россия, Татарстан, гор. Казань, ул. Дубравная, д. 51, кв. 116",
                    Description = "положительный клиент, своевременные оплаты",
                    Created = new DateTime(2010, 01, 01),
                    Edited = new DateTime(2014, 01, 01),
                    HeaderFio = string.Empty,
                    HeaderPost = string.Empty
                },
                new Customers
                {
                    Id = 2,
                    CustomerType = CustomerType.ЮридическоеЛицо,
                    Title = "Мартин Лютер",
                    FullFio = "ООО 'Мартин Лютер'",
                    Phone = "+8432555222",
                    Email = "info@martinl.com",
                    Address = "420138, Россия, Татарстан, гор. Казань, ул. Дубравная, д. 5",
                    Description = "своевременные оплаты",
                    Created = new DateTime(2011, 01, 01),
                    Edited = new DateTime(2013, 01, 01),
                    HeaderFio = "Джеси Пинкман Хайзенбергович",
                    HeaderPost = "Директор"
                }
            };
        }

        public override void GetItem(Action<List<Customers>, Exception> completed)
        {
            try
            {
                completed(mockCustomers, null);
            }
            catch (Exception ex)
            {
                completed(null, ex);
            }
        }

        public override void AddItem(Customers item, Action<Exception> completed)
        {
            mockCustomers.Add(item);
        }

        public override void RemoveItem(Customers item)
        {
            mockCustomers.Remove(item);
        }

        public override void Edit(Customers item, Action<Exception> completed)
        {
            MessageBox.Show("Edit not implemented");
        }
    }
}
